<script type="text/javascript" language="javascript" charset="utf-8">
    $('error_messages').innerHTML = '<?php echo $error?>';
    new Effect.Appear('error_messages');
    <?php
        if(!empty($id)) {
            echo "$('{$error_on}_{$id}').innerHTML = '$value';";
            echo "$('{$error_on}_{$id}').className += ' form_error';";
        }
    ?>
</script>